package com.demo.resourcecode.c11mvc;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.format.datetime.DateFormatter;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class IniBinderHandlerControllerAdvice {

    private static final Logger logger = LoggerFactory.getLogger(IniBinderHandlerControllerAdvice.class);

    @InitBinder
	public void initBinder(WebDataBinder binder) {
		// 添加yyyy-MM-dd类型的格式化工具
		binder.addCustomFormatter(new DateFormatter("yyyy-MM-dd"));
	}

}